<?php
/**
 * 标签名称，比如这个使用!{attr}这样调用
 * @var string
 */
$self_tag_name = 'attr';

/**
 * @param array $params 参数
 * @param Smarty $smarty
 */
function smarty_function_attr($params, &$smarty){
	global $formHelper;
// 	$forms_obj = $smarty->getVariable('forms');
// 	if(empty($forms_obj))return '';
	$forms = $formHelper->form;
	$groups = $formHelper->groups;
	$item_lists = $formHelper->item_lists;
// 	print_r($formHelper);exit;
	$name = $params['name'];
	$type = 'items';
	if(isset($params['type'])){
		$type = $params['type'];
	}
	$is_mutil_lan = $formHelper->mutil_lan;
	
	$language = false;
	if(isset($params['language'])){
		$language = $params['language'];
	}

	$group_id = $params['group'];

	$item = $item_lists[$name];
// 	print_r($item);
	if(empty($item))return '';
	$item['id'] = $name;
//	if($item['name'] == 'city'){
//	}
	
	$type = $item['type'];
	$attr_class_name = ucfirst($type) . 'Attr';
	$attr_obj = new $attr_class_name($item, null, $language);
	$attr_obj->formHelper = &$formHelper;
	return $attr_obj->get_html();
}